<template>
	<div>
		<div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="el-icon-date"></i> 编辑</el-breadcrumb-item>
                <el-breadcrumb-item v-if="data">{{data.title}}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="form-box">
			<From :form="data" v-if="data"></From>
		</div>
	</div>
</template>

<script>
	import From from './form';

	export default {
		data() {
			return {
				url: 'note',
				data: undefined
			}
		},
		created() {
			this._loadData();
		},
		methods: {
			_loadData() {
				this.$http.get(this.url + '/'+ this.$route.params.id + '/edit').then((response) => {
					this.data = response.data;
					if(this.data.created_at) {
						delete this.data.created_at;
					}
					if(this.data.updated_at) {
						delete this.data.updated_at;
					}
				})
			}
		},
		components: {
            From
        }
	}
</script>

<style scope>
.form-box{
	margin-top: 25px;
}
</style>